import { RouteProps } from "react-router-dom";
import HomePage from "../pages/home";
import DetailPage from "../pages/detail";
import Login from "../pages/login";
import Layout from "../pages/layout";
import Photo from "../pages/photo";

export interface IRoutes extends RouteProps {
  routes?: IRoutes[];
  ComponentName: any;
  name?: string;
}
/**
 * 路由在这里配置 由于router匹配规则 所以顺序不能变
 */
const routes: IRoutes[] = [
  {
    path: "/login",
    exact: false,
    ComponentName: Login,
  },
  {
    path: "/photo",
    exact: false,
    ComponentName: Photo,
  },
  {
    path: "/",
    ComponentName: Layout,
    exact: false,
    routes: [
      {
        path: "/",
        exact: true,
        ComponentName: HomePage,
      },
      {
        path: "/detail",
        exact: false,
        ComponentName: DetailPage,
      },
    ],
  },
];
export default routes;
